<template>
    <div class="app-container" ref="content">
        <div style="text-align: center;padding: 10px">每日任务《{{userTaskInfo.name}}》-详情信息</div>
        <el-row :gutter="10">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
            <el-form :model="userTaskInfo" ref="userTaskInfo" label-width="150px">
                <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="企业名称:" prop="enterpriseName">
                            {{ userTaskInfo.enterpriseName }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="任务名称:" prop="disPlayName">
                            {{ userTaskInfo.disPlayName }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="任务编码" prop="code">
                            {{ userTaskInfo.code }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="24">
                        <el-form-item label="任务内容:" prop="content">
                            {{ userTaskInfo.content }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="执行人员Id:" prop="userId">
                            {{ userTaskInfo.userId }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="发布任务用户:" prop="pushUser">
                            {{ userTaskInfo.pushUser }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="任务状态:" prop="status">
                            {{ userTaskInfo.status | infoStatus }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="任务计划开始时间:" prop="startTime">
                            {{ userTaskInfo.startTime | dateFormat }}
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
                        <el-form-item label="任务计划结束时间:" prop="endTime">
                            {{ userTaskInfo.endTime | dateFormat }}
                        </el-form-item>
                    </el-col>
                </el-col>
            </el-form>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import {getInUserTaskVo} from "@/api/taskinfo";

export default {
    name: "info",
    data(){
        return{
            userTaskInfo:{

            }
        }
    },
    created() {
        this.$nextTick(() => {
            this.getInUserTaskVo(this.$route.params.ucId)
        });
    },
    methods:{
        getInUserTaskVo(val){
            //获取企业信息数据
            let loadingInstance = this.$loading({
                target:this.$refs.content,
                text:'数据加载中'
            });
            getInUserTaskVo({ucId:val}).then(res=>{
                console.log(res)

                this.userTaskInfo = res.data
                loadingInstance.close()
                this.$notify.success({
                    title: '成功',
                    message: "获取每日信息成功"
                })
            }).catch(error=>{
                console.log(error)
                loadingInstance.close()
                this.$notify.error({
                    title: '失败',
                    message: "获取每日任务信息失败"
                })
            })
        },

    },
    filters:{
        infoStatus(val){
            let status = "";
            switch (val){
                case 0:
                    status = "已下发";
                    break;
                case 1:
                    status = "进行中";
                    break;
                case 2:
                    status = "延迟";
                    break;
                case 3:
                    status = "已完成 ";
                    break;
                case 4:
                    status = "已取消 ";
                    break;
                default:
                    break;
            }
            return status;
        }
    }

}
</script>
